using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class WSingle_WSingle : System.Web.UI.Page
{
    private Srvtools.WebDataSet WMaster;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitializeComponent();

            

            ddlstatus.SelectedValue = "1";
            if (Request["mode"] != null && Request["mode"].ToString() == "t")
            {
                ddlstatus.Enabled = true;
            }
            else
            {
                ddlstatus.Enabled = false;
            }

            WMaster.SetWhere("EmpStatus=" + ddlstatus.SelectedValue);

            Master.DataSource = WMaster;

        }
    }

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WSingle_WSingle));
        this.WMaster = new Srvtools.WebDataSet();
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).BeginInit();
        // 
        // WMaster
        // 
        this.WMaster.Active = true;
        this.WMaster.AlwaysClose = false;
        this.WMaster.PacketRecords = 50;
        this.WMaster.Position = -1;
        this.WMaster.RemoteName = "SEmployees.ViewSelEmployees";
        this.WMaster.ServerModify = false;
        ((System.ComponentModel.ISupportInitialize)(this.WMaster)).EndInit();
    }

    protected void wgvMaster_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DataRowView drv = (DataRowView)e.Row.DataItem;
            //HiddenField hd = (HiddenField)e.Row.FindControl("hd");
            //hd.Value = drv["EmployeeId"].ToString();
            //hd.ID =  hd.Value;


          


            Literal lit = (Literal)e.Row.FindControl("lithid");
            lit.Text = "<input type='hidden' name='hidid' value='" + drv["EmployeeId"].ToString() + "'/>";

            Literal lname = (Literal)e.Row.FindControl("lithname");
            lname.Text = "<input type='hidden' name='hidname' value='" + drv["EmpName"].ToString() + "'/>";
        }
    }

    //protected void GVUser_PageIndexChanging(object sender, GridViewPageEventArgs e)
    //{
    //    GVUser.PageIndex = e.NewPageIndex;

    //    InitializeComponent();

    //    GVUser.DataSource = WMaster;
    //    GVUser.DataBind();
    //}

    protected void Button1_Click(object sender, EventArgs e)
    {
        string strDep = dptlist.SelectDepmanetId;
        if (strDep != "0" && strDep != "")
        {
            strDep = " like ('" + strDep + "%')";
        }
        else
        {
            strDep = " <> -1";
        }

        string sname = SelName.Text;
        if (sname != "")
        {
            sname = "And EmpName like ('" + sname + "%')";
        }
        else
        {
            sname = "";
        }


        InitializeComponent();
        WMaster.SetWhere(" Employees.DepartmentId" + strDep + sname + " and EmpStatus=" + ddlstatus.SelectedValue);
        Master.DataSource = WMaster;
    }


}
